class BubbleSort
{
    public static void main ( String [ ] arg )
    {
        //var declarations begin
        int i;
        int j;
        int size;
        int temp;
        int[] array;
        boolean sorted;
        //var declarations end

        size = 10;
        array = new int[size] ;

        //initialize array
        array[0] = 20;
        array[1] = 7;
        array[2] = 12;
        array[3] = 18;
        array[4] = 2;
        array[5] = 11;
        array[6] = 6;
        array[7] = 9;
        array[8] = 19;
        array[9] = 5;

        j = 0;
        while (j < (size))
        {
            System.out.println(array[j]);
            j = j + 1;
        }

        System.out.println(true);

        sorted = false;
        j = 0;
        while (!sorted)
        {
            sorted = true;
            i = 0;

            while (i < size - j - 1)
            {
                if (array[i] < array[i + 1])
                {
                    sorted = false;
                    temp = array[i];
                    array[i] = array[i + 1];
                    array[i + 1] = temp;
                }
                i = i + 1;
            }
            j = j + 1;
        }

        j = 0;
        while (j < size)
        {
            System.out.println(array[j]);
            j = j + 1;
        }
    }
}